<?php
include("d:/collect_new/collect/reset/json_fx.php");
$httpheader=<<<TEXT
POST https://widget.1688.com/front/ajax/getJsonComponent.json HTTP/1.1
Host: widget.1688.com
Connection: keep-alive
Content-Length: 494
sec-ch-ua: "Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"
Accept: application/json, text/plain, */ *
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
DNT: 1
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36
sec-ch-ua-platform: "Windows"
Origin: https://widget.1688.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://widget.1688.com/front/ajax/bridge.html?target=brg-2399
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,ja;q=0.6,bg;q=0.5,zh-TW;q=0.4,ru;q=0.3,th;q=0.2
Cookie: SameSite=none; SameSite=none; __mwb_logon_id__=undefined; _m_h5_tk=220352595a7d17523c50f45f19ff4111_1677579996583; _m_h5_tk_enc=74015d30a4952b606ba09d8ac503214a; xlly_s=1; cna=J9YiHCH/FhQCAbSMoJIPUvPl; cookie2=1c4adb4cadea3e2711591526568ecbcb; sgcookie=E100rO%2FkTxVun1UZ5x2L1aOGJmOX%2BzEMZXh0Jq6bIw5XruELdQwOfvLL1%2FtTKRFsrn62WarNTv3QA1yIo2QVG0h83m7V%2FtJEPzYnbeYzlmoJ9t4%3D; t=18ed6bb0e34986353c9741f4babf1907; _tb_token_=39573a433de7e; lid=yzs1013; uc4=id4=0%40VXtaSWpGBRARtNDb1cz884FkkQ%3D%3D&nk4=0%40GJ2FQQPI7120KRgMZDfCd6of; __cn_logon__=false; _csrf_token=1677571873290; alicnweb=touch_tb_at%3D1677574679060; isg=BFxc-CGrU5L-lSfOUM8d9TSVLXoO1QD_nFhdTjZdGMcrgfwLXuTJjpl44eF5CThX; tfstk=cc4GB0GlRlo_pObYdRg1rgwbzvncCSJxEor386_LLH-LudLn_c5cjH-z7T6nCT6wc; l=fB_DKlr7TqRQm5q5BOfwourza77OkIRAguPzaNbMi9fPOWBH5YJOW68IlrtMCnGNF6l2R3r0glSeBeYBqMIKnxvOCgpMGGkmn6k1tDf..; __mbox_csrf_token=y4Bcrn3lgk7Ywka1_1677579277537

namespace=cateMarketOfferList&widgetId=cateMarketOfferList&methodName=execute&params=%7B%22sceneId%22%3A%2227116%22%2C%22curPage%22%3A1%2C%22pageSize%22%3A20%2C%22sortType%22%3Anull%2C%22descendOrder%22%3Anull%2C%22priceStart%22%3Anull%2C%22priceEnd%22%3Anull%2C%22province%22%3A%22%22%2C%22city%22%3A%22%22%7D&sceneId=27116&curPage=1&pageSize=20&sortType=null&descendOrder=null&priceStart=null&priceEnd=null&province=&city=&__mbox_csrf_token=y4Bcrn3lgk7Ywka1_1677579277537&_input_charset=utf-8


TEXT;

$ch = curl_init();      
curl_setopt($ch, CURLOPT_URL, "http://collect1.longsunhd.com:81/collect/reset/json.php?getPhpCode=1");      
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );       
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);      
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);   
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0');      
curl_setopt($ch, CURLOPT_HEADER, 0);        
curl_setopt($ch, CURLOPT_TIMEOUT, 30);  
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);    
curl_setopt($ch, CURLOPT_POST, true );      
curl_setopt($ch, CURLOPT_POSTFIELDS, array("httpheader"=>$httpheader));     
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
$result=curl_exec($ch);  
$request_header = preg_replace("/^((POST|GET)\s*[^\s]+)\s+http/Uixs","\\1&XDEBUG_SESSION_START=543534 HTTP",curl_getinfo($ch, CURLINFO_HEADER_OUT)).http_build_query(array("httpheader"=>$httpheader))."\r\n\r\n";
$request_header = preg_replace('/Content\-Type\:[^\r\n]+/imx','Content-Type: application/x-www-form-urlencoded',$request_header);
//echo $request_header;exit;
curl_close($ch);
$data=json_decode($result,1);
print_r($data['result'][0]);
jsonCreateTable($data['result'][0],"qc_shopro_mall_product","ymh");
jsonToTable($data['result'],"qc_shopro_mall_product","ymh","select id from ymh.qc_shopro_mall_product where itemId='{\$data['itemId']}'");

